import React, {Component, Fragment} from 'react'
import {Link, Redirect} from "react-router-dom"

class Index extends Component {
    constructor(props) {
        super(props)
        this.state = {
            list: [
                {cid: 123, title: 'ι 花城 ঞ 个人博客-1'},
                {cid: 456, title: 'ι 花城 ঞ 个人博客-2'},
                {cid: 789, title: 'ι 花城 ঞ 个人博客-3'},
            ]
        }
        this.props.history.push("/home")
    }

    render() {

        return (
            <Fragment>
                <Redirect to="/home" />
                <ul>
                    {
                        this.state.list.map((item) => {
                            return (
                                <li key={item.cid}>
                                    <Link to={"/list/" + item.cid}>{item.title}</Link>
                                </li>
                            )
                        })
                    }
                </ul>
            </Fragment>
        );
    }
}

export default Index
